package com.ks.cms.controller;


import com.ks.cms.controller.dto.CmsClassRequest;
import com.ks.cms.entity.BCmsClass;
import com.ks.cms.service.IBCmsClassService;
import com.ks.core.base._ControllerBase;
import com.ks.core.core.Result;
import com.ks.core.dto.OperateBase;
import com.ks.core.dto.SearchCriteriaBase;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * <p>
 * 信息发布系统的信息栏目（按租户） 前端控制器
 * </p>
 *
 * @author kingdee123
 * @since 2020-12-22
 */
@RestController
@RequestMapping("/bCmsClass")
@Api(value = "管理模块",description = "管理模块")
public class BCmsClassController  extends _ControllerBase {
    @Autowired
    private IBCmsClassService bCmsClassService;

    @PostMapping("/selectCmsList")
    @ApiOperation(value = "栏目列表查询接口",notes = "栏目列表查询接口")
    public Object selectCmsList (@RequestBody SearchCriteriaBase searchCriteriaBase){
        Map<String,Object> resultMap =bCmsClassService.selectCmsList(getContext(),searchCriteriaBase);
        return Result.success(resultMap);
    }

    @PostMapping("/addCms")
    @ApiOperation(value = "栏目添加接口",notes = "栏目添加接口")
    public Object addCms (@RequestBody BCmsClass bCmsClass){
        int resultMap =bCmsClassService.addCms(getContext(),bCmsClass);
        return Result.success(resultMap);
    }


    @PostMapping("/updateCms")
    @ApiOperation(value = "栏目修改接口",notes = "栏目修改接口")
    public Object updateCms (@RequestBody BCmsClass bCmsClass){
        int resultMap =bCmsClassService.updateCms(getContext(),bCmsClass);
        return Result.success(resultMap);
    }


    @PostMapping("/deleteCms")
    @ApiOperation(value = "栏目删除接口",notes = "栏目删除接口")
    public Object deleteCms (@RequestBody CmsClassRequest request){
        int resultMap =bCmsClassService.deleteCms(getContext(),request.getId());
        return Result.success(resultMap);
    }
    /********************************************************************************/
   /* @PostMapping("/addBCmsClass")
    @ApiOperation(value = "栏目添加接口",notes = "栏目添加接口")
    public Object addBCmsClass(@RequestBody BCmsClass bCmsClass){
        int i = ibCmsClassService.addBCmsClass(getContext(),bCmsClass);
        return Result.success(i);
    }


    @PostMapping("/deleteBCmsClass")
    @ApiOperation(value = "栏目删除接口",notes = "栏目删除接口")
    public Object deleteBCmsClass(@RequestBody OperateBase operateBase){
        int i = ibCmsClassService.deleteBCmsClass(getContext(),operateBase);
        return Result.success(i);
    }
    @PostMapping("/selectBCmsClassList")
    @ApiOperation(value = "栏目列表查询接口",notes = "栏目列表查询接口")
    public Object selectBCmsClassList(@RequestBody SearchCriteriaBase searchCriteriaBase){
        Map<String, Object> map = ibCmsClassService.selectBCmsClassList(getContext(),searchCriteriaBase);
        return Result.success(map);
    }*/
}

